<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // 借用构造函数继承父类型属性
        // 原理：通过call()把父类的this指向子类型的this，这样就可以实现子类型继承父类型的属性
        // 1. 父类型函数
        function Father(uname, age) {
            this.uname = uname;
            this.age = age;
        }

        function Son(uname, age, score) {
            Father.call(this, uname, age);
            this.score = score;
        }
        var son = new Son("刘德华", 18, 100);
        console.log(son);
    </script>
</body>

</html>